package cn.xq.pethome.employee.service.impl;

import cn.xq.pethome.base.service.impl.BaseServiceImpl;
import cn.xq.pethome.employee.domain.Employee;
import cn.xq.pethome.employee.domain.EmployeeBo;
import cn.xq.pethome.employee.mapper.EmployeeMapper;
import cn.xq.pethome.employee.query.EmployeeQuery;
import cn.xq.pethome.employee.service.IEmployeeService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;
@Service
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class EmployeeServiceImpl extends BaseServiceImpl<Employee> implements IEmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public List<Employee> fingall() {
        List<EmployeeBo> fingall = employeeMapper.findallbo();
        //将employeeBode的数据复制到employee里面
        ArrayList<Employee> employees = new ArrayList<>();
        for (EmployeeBo employeeBo : fingall) {
            Employee employee = new Employee();
            BeanUtils.copyProperties(employeeBo, employee);
            employees.add(employee);
        }
        return employees;
    }

    @Override
    public List<Employee> findquery(EmployeeQuery employeeQuery) {
        return null;
    }

    @Override
    public Long fingquerycount(EmployeeQuery employeeQuery) {
        return null;
    }


}
